{% import "admin-v2/macro.html.twig" as web_macro %}
<table class="table table-striped table-hover" id="chooser-list-table">
	<thead>
		<tr>
			<td class='text-center'>
				<input class="batch-select" type="checkbox">
			</td>
			<th>{{ 'admin.classroom_manage.chooser.num'|trans }}</th>
			<th width="30%">{{ 'admin.classroom_manage.chooser.name'|trans }}</th>
			<th>{{'admin.classroom_manage.chooser.student_num'|trans }}</th>
			<th>{{ 'admin.classroom_manage.chooser.price'|trans }}</th>
			<th>{{ 'admin.classroom_manage.chooser.status'|trans }}</th>
		</tr>
	</thead>
	<tbody>
		{% for classroom in targets %}
			{% set category = categories[classroom.categoryId]|default(null) %}
			{% import "admin-v2/macro.html.twig" as admin_macro %}
			<tr id="course-tr-{{ classroom.id }}">
				<td class='text-center' data-id="{{classroom.id}}">
					<input class="batch-item" type="checkbox" value="{{classroom.id}}" id="batch-item-{{ classroom.id|default() }}">
				</td>
				<td>{{ classroom.id }}</td>
				<td>
					<a href="{{ path('classroom_show', {id:classroom.id}) }}" target="_blank">
						<strong>{{ classroom.title|raw }}</strong>
					</a>
					<br>
					<span class="text-muted text-sm">{{ 'admin.classroom_manage.manage.category'|trans }}：{{ category.name|default('--') }}</span>
					{% if classroom.recommended %}
						<span class="label label-default">{{ 'admin.classroom_manage.chooser.recommend'|trans }}：{{ classroom.recommendedTime|date('Y-m-d') }}</span>
					{% endif %}
				</td>
				<td>{{ classroom.studentNum }}</td>
				<td class="text-danger">
					{% if setting('coin.coin_enabled') and setting('coin.price_type') == 'Coin' %}
						{% if classroom.price > 0 %}
							{{classroom.price * setting('coin.cash_rate') }}
							{{setting('coin.coin_name')}}
						{% else %}
							{{ 'admin.classroom_manage.chooser.free'|trans }}
						{% endif %}
					{% else %}
						{% if classroom.price > 0 %}
							{{ classroom.price }}{{ 'site.currency.CNY'|trans }}
						{% else %}
							{{ 'admin.classroom_manage.chooser.free'|trans }}
						{% endif %}
					{% endif %}
				</td>
				<td>
					{% if classroom.status=='published' %}
						<span class="text-success">{{'admin.classroom_manage.manage.published'|trans}}</span>
					{% elseif classroom.status=='closed'%}

						<span class="text-danger">{{'admin.classroom_manage.manage.closed'|trans}}</span>
					{% else %}
						{{'admin.classroom_manage.manage.unpublished'|trans}}
					{% endif %}
				</td>

			</tr>
		{% else %}
			<tr>
				<td colspan="20">
					<div class="empty">{{ 'admin.classroom_manage.chooser.empty'|trans({'%classroomName%':setting('classroom.name','classroom'|trans)}) }}</div>
				</td>
			</tr>
		{% endfor %}
	</tbody>
</table>

{% if paginator|default() %}
	{{ web_macro.ajax_paginator(paginator) }}
{% endif %}
